readDir

part of wslib

an additional method to Buffer which can load all soundfiles in a specified folder to separate buffers at once.

Since SC 3.3 this method has changed to work asynchronously. For loading multiple dirs with large amounts of samples it is best to use the action for initiating every next load instead of loading them all at once.

Buffer:readDir ( path, bufnumOffset, ext, server, notify, nlevels, action )

returns an array with all buffers

path : the path of the folder

bufnumOffset : the bufnum of the first buffer; readDir will count on from there for the following buffers.

** readDir will overwrite existing buffers if they are there **

ext : the filename extension for the soundfiles. readDir can only get one type of soundfiles at a time from a

folder. The default extenstion is "wav"

server : the Server on which the buffers will be loaded

notify : if true (default) eadDir will show all loaded buffers and their soundfile names in the post window

nlevels : number of levels to search inside the directory

action : action to be performed when all buffers are loaded. The only argument is the array of buffers

b = Buffer.readDir( "sounds", 10, "aiff" ); // reports in the post window

b.do( _.play );